package com.kk.permission.utils;

import android.content.Context;
import android.preference.PreferenceManager;

import com.kk.permission.adapter.PermissionAdapter;

public class PrefUtil {
    public static final String CONTROL_DISABLE = "NO";
    public static final String CONTROL_ENABLE = "YES";
    public static String ControlPrefix = "control_";
    private static final String TAG = "PrefUtil";

    public static int getKeyInt(String str, int i) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyInt(str, i);
    }

    public static int getKeyIntRes(String str, int i) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyIntRes(str, i);
    }

    public static boolean getKeyBoolean(String str, boolean z) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyBoolean(str, z);
    }

    public static boolean getKeyBooleanRes(String str, int i) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyBooleanRes(str, i);
    }

    public static String getKeyString(String str, String str2) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyString(str, str2);
    }

    public static String getKeyStringRes(String str, int i) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyStringRes(str, i);
    }

    public static long getKeyLong(String str, long j) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyLong(str, j);
    }

    public static float getKeyFloat(String str, float f) {
        return PermissionAdapter.getAdapter().prefUtilGetKeyFloat(str, f);
    }

    public static void setKey(String str, int i) {
        PermissionAdapter.getAdapter().prefUtilSetKey(str, i);
    }

    public static void setKey(String str, boolean z) {
        PermissionAdapter.getAdapter().prefUtilSetKey(str, z);
    }

    public static void setKey(String str, String str2) {
        PermissionAdapter.getAdapter().prefUtilSetKey(str, str2);
    }

    public static void setKey(String str, long j) {
        PermissionAdapter.getAdapter().prefUtilSetKey(str, j);
    }

    public static void setKey(String str, float f) {
        PermissionAdapter.getAdapter().prefUtilSetKey(str, f);
    }

    public static void deleteKey(String str) {
        PermissionAdapter.getAdapter().prefUtilDeleteKey(str);
    }

    public static void putBoolean(Context context, String key, boolean value) {
        PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).commit();
    }

    public static boolean getBoolean(Context context, String key) {
        return getBoolean(context, key, false);
    }

    public static boolean getBoolean(Context context, String key, boolean defValue) {
        return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(key, defValue);
    }
}
